# 元组
#不可修改序列
tuple1 = (1,2,3,4,5)
print(tuple1)

# 单个元素
tuple2 = (1,)
print(tuple2)

# 推导式创建
tuple3 = tuple(i for i in range(5))
print(tuple3)

# 通过join生成
print(''.join((tuple(i for i in "abc"))))

print("")

# 查找(通过下标)
print(tuple3[3])

print("")

# 元组本身不可以修改，但是嵌套列表是可以修改的
tuple4 = (1,2,3,[1,2,3])
print(tuple4)
print(tuple4[3])
tuple4[3][2]=4
print(tuple4[3])

print("")

# 遍历
tuple5 = ('a','b','c')
for i in tuple5:
    print(i)